<template>
    <el-table :data="tableData" style="width: 100%">

        <el-table-column label="创建时间" width="150">
            <template slot-scope="scope">
                <i class="el-icon-time"></i>
                <span style="margin-left: 10px">{{ scope.row.date }}</span>
            </template>
        </el-table-column>

        <el-table-column label="更新时间" width="150">
            <template slot-scope="scope">
                <i class="el-icon-time"></i>
                <span style="margin-left: 10px">{{ scope.row.date }}</span>
            </template>
        </el-table-column>

        <!-- <el-table-column prop="name" label="标题" width="180">
            
        </el-table-column>         -->
        <el-table-column label="标题" width="500">
            <template slot-scope="scope">
                <span @click="gotoLib(scope.row.libId)" class="link">{{ scope.row.title }}</span>
            </template>
        </el-table-column>

        <el-table-column label="操作">
            <template slot-scope="scope">
                <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
            </template>
        </el-table-column>

    </el-table>
</template>

<script>
export default {
    name: "VMain",
    data() {
        return {
            tableData: [{
                date: '2016-05-02',
                title: '王小虎',
                libId: '123456abc'
            }, {
                date: '2016-05-04',
                title: '王小虎5555',
                libId: '234567dfg'
            }]
        }
    },
    methods: {
        handleEdit(index, row) {
            console.log(index, row.libId);
        },
        handleDelete(index, row) {
            console.log(index, row);
        },
        gotoLib(libId) {
            this.$router.push({ path: `/lib/${libId}` });
        }
    }

}
</script>

<style lang="less" scoped>
th {
    height: 20px;
}

.link {
    cursor: pointer;
}
.link:hover {

    text-decoration: underline;
}
</style>